package com.hs.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.entity.ClassQaAnswer;
import com.hs.mapper.ClassQaAnswerMapper;
import com.hs.service.ClassQaAnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassQaAnswerServiceImpl implements ClassQaAnswerService {
    @Autowired
    private ClassQaAnswerMapper classQaAnswerMapper;
    @Override
    public int deleteById(Integer id) {
        return classQaAnswerMapper.deleteById(id);
    }

    @Override
    public int addClassQaAnswer(ClassQaAnswer classQaAnswer) {
        return classQaAnswerMapper.addClassQaAnswer(classQaAnswer);
    }

    @Override
    public int updateClassQaAnswer(ClassQaAnswer classQaAnswer) {
        return classQaAnswerMapper.updateClassQaAnswer(classQaAnswer);
    }

    @Override
    public ClassQaAnswer getClassQaAnswerById(Integer id) {
        return classQaAnswerMapper.getClassQaAnswerById(id);
    }

    @Override
    public PageInfo<ClassQaAnswer> getClassQaAnswerPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ClassQaAnswer> cc = classQaAnswerMapper.getClassQaAnswerByClassALL();
        PageInfo<ClassQaAnswer> pageInfo = new PageInfo<>(cc);
        return pageInfo;
    }

    @Override
    public List<ClassQaAnswer> getClassQaAnswerByQaId(int cqqId) {
        List<ClassQaAnswer> classQaAnswerByClassQaQuestionId = classQaAnswerMapper.getClassQaAnswerByClassQaQuestionId(cqqId);
        return classQaAnswerByClassQaQuestionId;
    }
}
